package com.example.ndkjnidemo.home.threadcallback;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.blankj.utilcode.util.LogUtils;
import com.example.ndkjnidemo.databinding.ActivityThreadCallbackBinding;

/**
 *
 */
public class ThreadCallbackActivity extends AppCompatActivity {

    private static final String TAG = "ThreadCallbackActivity";
    private ActivityThreadCallbackBinding binding;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        binding = ActivityThreadCallbackBinding.inflate(getLayoutInflater());
        setContentView(binding.getRoot());

        //===
        onMethodCallBack();
    }

    public void onMethodCallBack() {
        JNIThreadCallback jniThreadCallBack = new JNIThreadCallback();
        jniThreadCallBack.nativeCallBack(new INativeListener() {
            @Override
            public void onCall() {
                LogUtils.i(TAG, "onCall invoked,threadName:" + Thread.currentThread().getName());
            }
        });
        jniThreadCallBack.nativeInThreadCallBack(new INativeThreadListener() {
            @Override
            public void onSuccess(String msg) {
                LogUtils.i(TAG, "onSuccess invoked,msg:" + msg);
                LogUtils.i(TAG, "onSuccess invoked,threadName:" + Thread.currentThread().getName());
            }
        });
    }
}